<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateSettlementReportsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('settlement_reports', function (Blueprint $table) {
            $table->increments('id');
            $table->timestamp('business_date')->nullable();
            $table->string('cinema_code',20);
            $table->string('screen_code',20);
            $table->string('session_code',20);
            $table->string('film_code',20);
            $table->timestamp('session_datetime')->nullable();
            $table->integer('local_sales_count');
            $table->bigInteger('local_sales');
            $table->integer('local_refund_count');
            $table->bigInteger('local_refund');
            $table->integer('online_sales_count');
            $table->bigInteger('online_sales');
            $table->integer('online_refund_count');
            $table->bigInteger('online_refund');
            $table->integer('past_sales_count');
            $table->bigInteger('past_sales');
            $table->integer('flag')->default(1);
            $table->integer('type')->nullable();
            $table->unique('session_code');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('settlement_reports');
    }
}
